package com.hs.share.study.annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

/**
 *
 * @author hesheng
 *
 */
public class StudyTest {

	@Study(id = 1, name = "method_1")
	public void method_1() {
		System.out
				.println("----------------------------method_1----------------------------");
		Method[] methods = this.getClass().getMethods();
		for (int i = 0; i < methods.length; i++) {
			System.out.print(methods[i].getName() + " paras is ");
			Class<?>[] classes = methods[i].getParameterTypes();
			for (int j = 0; j < classes.length; j++) {
				System.out.print(classes[j].getName());
			}
			System.out.println();
		}
	}

	@Study(id = 2, name = "method_2", desc = "test")
	public void method_2(int count) {
		System.out
				.println("----------------------------method_2----------------------------");
		Annotation[] annotations = this.getClass().getAnnotations();
		for (int i = 0; i < annotations.length; i++) {
			System.out.println(annotations[i].getClass().getName());
		}

	}

	@Study(id = 3, name = "method_3", desc = "test")
	public void method_3(String str) {
		System.out
				.println("----------------------------method_3----------------------------");
		Method[] methods = this.getClass().getMethods();
		for (int i = 0; i < methods.length; i++) {
			Annotation[] annotations = methods[i].getAnnotations();
			for (int j = 0; j < annotations.length; j++) {
				System.out.print(annotations[j].getClass().getName());
			}
		}
		System.out.println();
	}

	@Study(id = 1, name = "method_4", desc = "test")
	public void method_4(Double value) {

	}

	public static void main(String[] args) {
		StudyTest test = new StudyTest();
		test.method_1();
		test.method_2(2);
		test.method_3(null);
	}
}
